from django.contrib import admin
from django.urls import path, re_path
from .views import *

app_name = 'users'
urlpatterns = [
    path('register/', Regist.as_view(), name='register'),
    path('login/', LoginView.as_view(), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),
    path('info/', UserInfoView.as_view(), name='info'),
    # 展示地址
    path('addresses/', AddressView.as_view(), name='address'),
    # 新增用户地址
    path('addresses/create/', AddressCreateView.as_view()),
    # 设置默认地址
    path('addresses/<int:address_id>/default/', DefaultAddressView.as_view()),
    path('orders/info/<int:page_num>/', UserOrderInfoView.as_view(), name='myorderinfo'),
    re_path('usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/', UsernameCountView.as_view()),
    re_path(r'mobiles/(?P<mobile>1[3-9]\d{9})/count/', MoblieCountView.as_view()),

]
